Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pallet-revive] Add host function to_account_id #7091

Merged

Conversation

cmichi
Copy link
Contributor

@cmichi cmichi commented Jan 8, 2025

@cmichi cmichi changed the title Add host function to_account_id [pallet-revive] Add host function to_account_id Jan 8, 2025
substrate/frame/revive/uapi/src/host/riscv64.rs Outdated Show resolved Hide resolved
substrate/frame/revive/src/wasm/runtime.rs Outdated Show resolved Hide resolved
substrate/frame/revive/src/benchmarking/mod.rs Outdated Show resolved Hide resolved
substrate/frame/revive/src/wasm/runtime.rs Outdated Show resolved Hide resolved
Comment on lines 565 to 568
let caller = whitelisted_caller();
let origin: T::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into();
Contracts::<T>::map_account(origin.clone()).unwrap();
let address = T::AddressMapper::to_address(&caller);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also fix the type inference error (hopefully).

Suggested change
let caller = whitelisted_caller();
let origin: T::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into();
Contracts::<T>::map_account(origin.clone()).unwrap();
let address = T::AddressMapper::to_address(&caller);
let address = {
let caller = account("seal_to_account_id", 0, 0));
T::AddressMapper::map(&caller).unwrap();
T::AddressMapper::to_address(&caller)
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just applied your suggestion. I didn't get a type inference error locally though when running the benchmark, where did you see it?

Copy link
Member

@athei athei Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI failed with a compilation error.

@athei athei added the T7-smart_contracts This PR/Issue is related to smart contracts. label Jan 15, 2025
@athei
Copy link
Member

athei commented Jan 15, 2025

/cmd fmt

Copy link

Command "fmt" has started 🚀 See logs here

Copy link

Command "fmt" has failed ❌! See logs here

@athei
Copy link
Member

athei commented Jan 15, 2025

Okay you have to run cargo +nightly fmt locally as we can't push on your branch. Also, CI is failing for the benchmark. Maybe my suggestion broke something. Can you run the pallet-revive tests locally with the runtime-benchmarks feature enabled to check what is wrong?

@cmichi
Copy link
Contributor Author

cmichi commented Jan 15, 2025

@athei I updated the PR.

@athei
Copy link
Member

athei commented Jan 15, 2025

We merged #7164 and #7163 in the meantime which broke your test. You just need to remove some parameters.

@athei athei enabled auto-merge January 15, 2025 21:41
@athei athei added this pull request to the merge queue Jan 15, 2025
Merged via the queue into paritytech:master with commit 412aca6 Jan 15, 2025
193 of 204 checks passed
ordian added a commit that referenced this pull request Jan 16, 2025
* master: (33 commits)
  Implement `pallet-asset-rewards` (#3926)
  [pallet-revive] Add host function `to_account_id` (#7091)
  [pallet-revive] Remove revive events (#7164)
  [pallet-revive] Remove debug buffer (#7163)
  litep2p: Provide partial results to speedup GetRecord queries (#7099)
  [pallet-revive] Bump asset-hub westend spec version (#7176)
  Remove 0 as a special case in gas/storage meters (#6890)
  [pallet-revive] Fix `caller_is_root` return value (#7086)
  req-resp/litep2p: Reject inbound requests from banned peers (#7158)
  Add "run to block" tools (#7109)
  Fix reversed error message in DispatchInfo (#7170)
  approval-voting: Make importing of duplicate assignment idempotent (#6971)
  Parachains: Use relay chain slot for velocity measurement (#6825)
  PRDOC: Document `validate: false` (#7117)
  xcm: convert properly assets in xcmpayment apis (#7134)
  CI: Only format umbrella crate during umbrella check (#7139)
  approval-voting: Fix sending of assignments after restart (#6973)
  Retry approval on availability failure if the check is still needed (#6807)
  [pallet-revive-eth-rpc] persist eth transaction hash (#6836)
  litep2p: Sufix litep2p to the identify agent version for visibility (#7133)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T7-smart_contracts This PR/Issue is related to smart contracts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[revive]: exposing to_account_id to smart contracts
3 participants